require "erb";

class PHPModel
  attr_accessor :attributes, :model_name, :table_name;
  
  def initialize(opts)
    @attributes = opts[:attributes];
    @model_name, @table_name, @plural = opts[:model_name], opts[:table_name], opts[:plural];
    @created_at = opts[:created_at];
  end
  
  def make_code
    code = File.open("tests/php_create/model.php.erb"){|f| f.read;};
    code = ERB.new(code);
    code.run(binding);
  end
    
end

php_model = PHPModel.new(
  :model_name => "Post",
  :table_name => "posts",
  :plural => "posts",
  :attributes => {
    :title => "text",
    :body => "text"
  },
  :created_at => true
);

print php_model.make_code;